home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Tools⁄Additions / MacTCPToolBx / TCP XCMD Docs / card_2289.txt < prev    next >
Text File  |  1989-06-01  |  2KB  |  44 lines

  1. -- card: 2289 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 3170
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 9
  9. ----- text -----
  10. Function:
  11.  
  12. -- part contents for background part 1
  13. ----- text -----
  14. TCPRecvMsg(connID,timeout,okChar,limit)
  15.  
  16. -- part contents for background part 2
  17. ----- text -----
  18. Receive characters from a TCP connection.
  19.  
  20. -- part contents for background part 3
  21. ----- text -----
  22. connID
  23. timeout
  24. okChar
  25. limit
  26.  
  27. -- part contents for background part 7
  28. ----- text -----
  29. the ID of the TCP connection
  30. number of ticks (1/60ths of a second) to wait, or zero
  31. character the message must start with to be OK (not error)
  32. maximum number of characters to be accepts
  33.  
  34. -- part contents for background part 4
  35. ----- text -----
  36. This XCMD is intended to read messages from the SMTP, NNTP, and POP protocols. Most messages start with a line indicating success or failure. The first character of this first line is sufficient to disambiguate success and failure returns. For SMTP and NNTP, the initial success character is "2" (first digit of a number). For POP, the first character is "+". The okChar parameter tells the XCMD what initial character should be present for "success;" any other character is considered a
  37. "failure." In some other cases there is no initial success/failure line. For these types of messages, okChar should be empty. In either case, the message body is a series of text lines, terminated with a period on a line by itself. Any other lines which start with period, have a second period inserted at the start.
  38.  
  39. This XCMD also does some appropriate filtering: it removes linefeeds and nulls, it removes control-Hs and the character immediately before it, it takes out the second period inserted by the sender on lines that start with a period, and it converts tabs to spaces.
  40.  
  41. For failed messages (which do not start with the okChar and if okChar is not empty), it returns the the line surrounded by
  42. "‚Ä¢‚Ä¢‚Ä¢"s. This makes it fairly easy to check for error conditions.
  43.  
  44. If the space limit is reached, the message is still received up to the end, but only the first limit characters are kept, and the string "‚Ä¢‚Ä¢‚Ä¢ message too big ‚Ä¢‚Ä¢‚Ä¢" is appended to the end.